/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.supinfo.youfood.web.servlet.client;

import com.supinfo.youfood.entity.Employe;
import com.supinfo.youfood.entity.Menu;
import com.supinfo.youfood.service.MenuService;
import java.io.IOException;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Michael
 */
@WebServlet(name = "ListMenuServlet", urlPatterns = {"/Menu"})
public class ListMenuServlet extends HttpServlet {

    @EJB
    private MenuService menuService;
    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Employe employe = (Employe) request.getSession().getAttribute("currentEmp");
        
        //Menus disponibles
        List<Menu> menus = employe.getResto().getMenus();
        request.setAttribute("menus", menus);
        
        //redirection vers la page menu
        request.getRequestDispatcher("/jsp/client/menu.jsp").forward(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
    }
}
